import React, { useState, useEffect } from "react";

export default function useLevel(score) {
  const [level, setLevel] = useState("不及格");
  useEffect(() => {
    if (score < 60) {
      setLevel("不及格");
    } else if (score < 70) {
      setLevel("及格");
    } else if (score < 80) {
      setLevel("良好");
    } else {
      setLevel("优秀");
    }
  }, [score]);
  return [level];
}
